﻿using System;

class SortingStringsByLength
    {
        static void Main()
        {
            string[] arr = { "12345", "123456", "1234", "54321", "12", "123456789" };
            int[] arry = new int[arr.GetLength(0)];
            for (int i = 0; i < arry.Length; i++)
            {
                arry[i] = arr[i].Length;
            }

            for (int i = 0; i < arry.Length - 1; i++)
            {
                int min = arry[i];
                string minTwo = arr[i];
                int indexOfMin = i;
                for (int j = i + 1; j < arry.Length; j++)
                {
                    if (arry[j] < min)
                    {
                        min = arry[j];
                        minTwo = arr[j];
                        indexOfMin = j;
                    }
                }
                int temp = arry[i];
                string tempTwo = arr[i];
                arry[i] = min;
                arr[i] = minTwo;
                arry[indexOfMin] = temp;
                arr[indexOfMin] = tempTwo;
            }
            foreach (var item in arr)
            {
                Console.WriteLine(item);
            }
        }
    }